package com.imooc.demo.csdn;

import org.jsoup.nodes.Document;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;


public class MyTest {

	List<String> list = new ArrayList<>();


	public static void main(String ... args) throws InterruptedException {

		new MyTest().testDetail1();

	}


	public void testDetail1() throws InterruptedException {
		list.add("https://blog.csdn.net/Shinnexi/article/details/99590424");


		// 随机访问其中一篇博客
		for (int i = 0; i <= 1000; i++) {
			Random random = new Random();
			int n = random.nextInt(list.size());
			String url = list.get(n);
			Document doc = JsoupUtils.getDocument(url);
			if (null != doc) {
				System.out.println("第" + i + "次抓取,url: " + url);
			}
		}
	}

}

